/*
 * claplan_beam.h
 *
 *  Created on: 2 Nov 2013
 *      Author: Tom Vercauteren
 */

#ifndef CLAPLAN_BEAM_H_
#define CLAPLAN_BEAM_H_

#include <string>
#include <ostream>

/** Supported energy modalities */
enum EnergyModalities
{
	/** photons (MV) */
	ENERGY_MODALITIES_PHOTONS,
	/** electrons (MeV) */
	ENERGY_MODALITIES_ELECTRONS,
	/** undefined */
	ENERGY_MODALITIES_UNDEFINED
};

struct ClaplanBeamMask
{
	unsigned char type_bg :1;
	unsigned char isocenter_anastruct :1;
	unsigned char gantry :1;
	unsigned char table :1;
	unsigned char coll :1;
	unsigned char linac :1;
	unsigned char modality :1;
	unsigned char energy :1;
	unsigned char wedge :1;
	unsigned char accessory :1;
	unsigned char contoured_anastruct :1;
	unsigned char margin :1;
	/** unused but set for memory alignement (padding) */
	unsigned char :4;
};

class ClaplanBeam
{
private:
	ClaplanBeamMask mask;
	int type_bg;
	std::string isocenter_anastruct;
	double gantry;
	double table;
	double coll;
	std::string linac;
	EnergyModalities modality;
	double energy;
	std::string wedge;
	std::string accessory;
	std::string contoured_anastruct;
	double margin;
public:
	ClaplanBeam();
	ClaplanBeam(const ClaplanBeam &cb);
	virtual ~ClaplanBeam();

	ClaplanBeam& operator=(const ClaplanBeam &cb);

	friend std::ostream & operator<<(std::ostream & os,
			const ClaplanBeam &beam);

	const std::string& getAccessory() const;
	void setAccessory(const std::string& accessory);
	void unsetAccessory();
	unsigned char isAccessorySet() const;

	double getColl() const;
	void setColl(double coll);
	void unsetColl();
	unsigned char isCollSet() const;

	const std::string& getContouredAnastruct() const;
	void setContouredAnastruct(const std::string& contouredAnastruct);
	void unsetContouredAnastruct();
	unsigned char isContouredAnastructSet() const;

	double getEnergy() const;
	void setEnergy(double energy);
	void unsetEnergy();
	unsigned char isEnergySet() const;

	double getGantry() const;
	void setGantry(double gantry);
	void unsetGantry();
	unsigned char isGantrySet() const;

	const std::string& getIsocenterAnastruct() const;
	void setIsocenterAnastruct(const std::string& isocenterAnastruct);
	void unsetIsocenterAnastruct();
	unsigned char isIsocenterAnastructSet() const;

	const std::string& getLinac() const;
	void setLinac(const std::string& linac);
	void unsetLinac();
	unsigned char isLinacSet() const;

	double getMargin() const;
	void setMargin(double margin);
	void unsetMargin();
	unsigned char isMarginSet() const;



	EnergyModalities getModality() const;
	void setModality(EnergyModalities modality);
	void unsetModality();
	unsigned char isModalitySet() const;


	double getTable() const;
	void setTable(double table);
	void unsetTable();
	unsigned char isTableSet() const;


	int getTypeBg() const;
	void setTypeBg(int typeBg);
	void unsetTypeBg();
	unsigned char isTypeBgSet() const;


	const std::string& getWedge() const;
	void setWedge(const std::string& wedge);
	void unsetWedge();
	unsigned char isWedgeSet() const;
};

#endif /* CLAPLAN_BEAM_H_ */
